﻿<div>
    <form action="/add/addProject" method="post">
        <table>
            <tr>
                <td>项目名称</td>
                <td><input name="projectName" placeholder="请输入项目名称" /></td>
            </tr>

            <tr>
                <td>所在国家</td>
                <td>
                    <select name="country">
                        <option>中国</option>
                        <option>俄罗斯</option>
                        <option>乌克兰</option>
                        <option>漂亮国</option>
                    </select>
                </td>
            </tr>

            <tr>
                <td>所在省市</td>
                <td>
                    <select name="province">
                        <option>北京</option>
                        <option>上海</option>
                        <option>成都</option>
                        <option>武汉</option>
                    </select>
                </td>
            </tr>

            <tr>
                <td>项目简介</td>
                <td><textarea name="desc" placeholder="请输入项目简介"></textarea></td>
            </tr>

            <tr>
                <td>项目业主</td>
                <td><input name="person" placeholder="请输入项目业主" /></td>
            </tr>

            <tr>
                <td>市场开发经理</td>
                <td>
                    <button class="btn btn-primary">选择</button>
                </td>
            </tr>

            <tr>
                <td>所属部门</td>
                <td>
                    <input name="department" disabled />
                </td>
            </tr>

            <tr>
                <td>每天成本（元）</td>
                <td>
                    <input type="number" id='cost' name="costs" />
                </td>
            </tr>

            <tr>
                <td>项目预期天数（天）</td>
                <td>
                    <input type="number" id="dayNum" name="dayNum" />
                </td>
            </tr>

            <tr>
                <td>预计成本（元）</td>
                <td>
                    <input id="preCost" disabled name="preCost" />
                </td>
            </tr>
            <tr>
                <td>市场经理电话</td>
                <td>
                    <input name="managerTelNum" />
                </td>
            </tr>
            <tr>
                <td>初录日期</td>
                <td>
                    <input name="date" type="date" />
                </td>
            </tr>
            <tr>

                <td>状态</td>
                <td>
                    <input name="status" type="radio" value="初录" />初录
                    <input name="status" type="radio" value="确认" />确认
                </td>
            </tr>
        </table>
        <input type="submit" value="提交" class="btn btn-primary" />
    </form>
</div>

<script>
    $(function(){


           var cost = 0
           var dayNum = 0
           var count = 0
             $('#cost').on('input', function(){
                 cost = parseInt($(this).val())
                 console.log(cost)
                  count =  cost*dayNum
                  $('#preCost').val(count)
            });

             $('#dayNum').on('input', function(){
                 dayNum = parseInt($(this).val())
                  console.log(dayNum)
                   count =  cost*dayNum
                    $('#preCost').val(count)
            });




    })

</script>